package com.example.websocket.config.core.json.extender.impl;

import com.example.websocket.config.core.json.extender.FieldExtender;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 将日期转换为时间戳的扩展器
 */
@Component
@Slf4j
public class DateToTimestampExtender implements FieldExtender {
    @Override
    public Object extend(Object value) {
        if (value instanceof java.util.Date) {
            return ((java.util.Date) value).getTime();
        }
        return null;
    }
}
